﻿Public Class frmCambiarClave

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim sError As String = ""
        Dim caserDataSet As New caserDataSet
        sError = CargarTabla(caserDataSet.login)
        If sError <> "" Then
            MessageBox.Show(sError, Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Error)
        End If

        If CType(caserDataSet.login.Rows(0), caserDataSet.loginRow).pass = txtPassOld.Text Then
          
            If txtPassNew.Text = txtPassRepeat.Text Then
                CType(caserDataSet.login.Rows(0), caserDataSet.loginRow).pass = txtPassNew.Text
                sError = GuardarTabla(caserDataSet.login)
                If sError <> "" Then
                    MessageBox.Show(sError, Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Error)
                Else
                    MessageBox.Show("Clave actualizada", Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Information)
                    Me.Close()
                End If
            Else
                MessageBox.Show("La contraseña nueva no coincide", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)

            End If
        Else
            MessageBox.Show("Contraseña anterior erronea", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End If
    End Sub

    Private Sub frmCambiarClave_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class